# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libmemcached
pkgver=1.1.4
pkgrel=1
pkgdesc="Client library and command line tools for memcached server (resurrected)"
url="https://github.com/awesomized/libmemcached"
arch="all"
license="BSD-3-Clause"
depends_dev="cyrus-sasl-dev"
makedepends="
	$depends_dev
	bison
	cmake
	flex
	libevent-dev
	memcached-dev
	samurai
	"
subpackages="$pkgname-dev $pkgname-libs"
source="$pkgname-$pkgver.tar.gz::https://github.com/awesomized/libmemcached/archive/refs/tags/$pkgver.tar.gz"
options="!check" # no tests built

build() {
	CXXFLAGS="$CXXFLAGS -flto=auto" \
	CFLAGS="$CFLAGS -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=ON \
		-DENABLE_SASL=ON
	cmake --build build
}

check() {
	# make check
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	# just junk top-level readme/changelog files from repo
	rm -r "$pkgdir"/usr/share/doc
}

sha512sums="
0a10a2431142ec6e4547f82fdd35b55c018264e5f8c39910a65252c3f53d862fb5945e7a671951915aac076767cc995740b3e499eb584017a38eb2d1e82171fb  libmemcached-1.1.4.tar.gz
"
